﻿using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using YJKStairs.CommonUnit;
using YJKStairs.DataInfos;

namespace YJKStairs.Kit
{
	public class CrossingStairsKit : ProjectionDrawingKit
	{
		public CrossingStairsKit(Autodesk.Revit.ApplicationServices.Application app) : base(app)
		{
		}

		private void CalcStairsRunsOriginPoints(ref CrossingStairs stairs)
		{
			LineRunData leftUpRunData = stairs.m_LeftUpRunData;
			LineRunData leftDownRunData = stairs.m_LeftDownRunData;
			LineRunData rightUpRunData = stairs.m_RightUpRunData;
			LineRunData rightDownRunData = stairs.m_RightDownRunData;
			double width = stairs.m_LandData.Width;
			double stairsWellWidth = stairs.GetStairsWellWidth();
			XYZ xyz = new XYZ(0.0, width, 0.0);
			XYZ xyz2 = new XYZ(stairsWellWidth, 0.0, 0.0);
			XYZ zero = XYZ.Zero;
			XYZ xyz3 = new XYZ(leftDownRunData.RunWidth, 0.0, 0.0);
			XYZ xyz4 = new XYZ(0.0, leftDownRunData.RunLength, 0.0);
			XYZ xyz5 = new XYZ(leftDownRunData.RunWidth, leftDownRunData.RunLength, 0.0);
			XYZ xyz6 = xyz4 + xyz;
			XYZ xyz7 = xyz5 + xyz;
			XYZ xyz8 = new XYZ(0.0, leftUpRunData.RunLength, 0.0);
			XYZ ptRunTopLeft = xyz6 + xyz8;
			XYZ ptRunTopRight = xyz7 + xyz8;
			XYZ xyz9 = new XYZ(rightDownRunData.RunWidth, 0.0, 0.0);
			XYZ xyz10 = new XYZ(0.0, rightDownRunData.RunLength, 0.0);
			XYZ xyz11 = xyz3 + xyz2;
			XYZ xyz12 = xyz11 + xyz10;
			XYZ xyz13 = xyz11 + xyz9;
			XYZ ptRunTopRight2 = xyz13 + xyz10;
			XYZ xyz14 = new XYZ(0.0, rightUpRunData.RunLength, 0.0);
			XYZ xyz15 = new XYZ(rightUpRunData.RunWidth, 0.0, 0.0);
			XYZ xyz16 = xyz12 + xyz;
			XYZ xyz17 = xyz16 + xyz15;
			XYZ ptRunTopLeft2 = xyz16 + xyz14;
			XYZ ptRunTopRight3 = xyz17 + xyz14;
			stairs.m_LeftDownRunData.PtRunBottomLeft = zero;
			stairs.m_LeftDownRunData.PtRunBottomRight = xyz3;
			stairs.m_LeftDownRunData.PtRunTopLeft = xyz4;
			stairs.m_LeftDownRunData.PtRunTopRight = xyz5;
			stairs.m_LeftUpRunData.PtRunBottomLeft = xyz6;
			stairs.m_LeftUpRunData.PtRunBottomRight = xyz7;
			stairs.m_LeftUpRunData.PtRunTopLeft = ptRunTopLeft;
			stairs.m_LeftUpRunData.PtRunTopRight = ptRunTopRight;
			stairs.m_RightDownRunData.PtRunBottomLeft = xyz11;
			stairs.m_RightDownRunData.PtRunBottomRight = xyz13;
			stairs.m_RightDownRunData.PtRunTopLeft = xyz12;
			stairs.m_RightDownRunData.PtRunTopRight = ptRunTopRight2;
			stairs.m_RightUpRunData.PtRunBottomLeft = xyz16;
			stairs.m_RightUpRunData.PtRunBottomRight = xyz17;
			stairs.m_RightUpRunData.PtRunTopLeft = ptRunTopLeft2;
			stairs.m_RightUpRunData.PtRunTopRight = ptRunTopRight3;
		}

		private void DealStairsTreadAlign(ref CrossingStairs stairs, int nTreadAlignType)
		{
			LineRunData leftUpRunData = stairs.m_LeftUpRunData;
			LineRunData leftDownRunData = stairs.m_LeftDownRunData;
			if (leftDownRunData.TreadCount != leftUpRunData.TreadCount)
			{
				double num = Math.Abs(leftDownRunData.RunLength - leftUpRunData.RunLength);
				XYZ xyz = new XYZ(0.0, num, 0.0);
				XYZ xyz2 = new XYZ(0.0, num / 2.0, 0.0);
				bool flag = false;
				if (leftDownRunData.TreadCount > leftUpRunData.TreadCount)
				{
					flag = true;
				}
				if (nTreadAlignType == 0)
				{
					if (flag)
					{
						stairs.m_RightDownRunData.PtRunBottomLeft += xyz;
						stairs.m_RightDownRunData.PtRunBottomRight += xyz;
						stairs.m_RightDownRunData.PtRunTopLeft += xyz;
						stairs.m_RightDownRunData.PtRunTopRight += xyz;
						stairs.m_RightUpRunData.PtRunBottomLeft += xyz;
						stairs.m_RightUpRunData.PtRunBottomRight += xyz;
						stairs.m_RightUpRunData.PtRunTopLeft += xyz;
						stairs.m_RightUpRunData.PtRunTopRight += xyz;
						return;
					}
					stairs.m_LeftDownRunData.PtRunBottomLeft += xyz;
					stairs.m_LeftDownRunData.PtRunBottomRight += xyz;
					stairs.m_LeftDownRunData.PtRunTopLeft += xyz;
					stairs.m_LeftDownRunData.PtRunTopRight += xyz;
					stairs.m_LeftUpRunData.PtRunBottomLeft += xyz;
					stairs.m_LeftUpRunData.PtRunBottomRight += xyz;
					stairs.m_LeftUpRunData.PtRunTopLeft += xyz;
					stairs.m_LeftUpRunData.PtRunTopRight += xyz;
					return;
				}
				else if (1 == nTreadAlignType)
				{
					if (flag)
					{
						stairs.m_LeftUpRunData.PtRunBottomLeft += xyz2;
						stairs.m_LeftUpRunData.PtRunBottomRight += xyz2;
						stairs.m_LeftUpRunData.PtRunTopLeft += xyz2;
						stairs.m_LeftUpRunData.PtRunTopRight += xyz2;
						stairs.m_RightDownRunData.PtRunBottomLeft += xyz2;
						stairs.m_RightDownRunData.PtRunBottomRight += xyz2;
						stairs.m_RightDownRunData.PtRunTopLeft += xyz2;
						stairs.m_RightDownRunData.PtRunTopRight += xyz2;
						stairs.m_RightUpRunData.PtRunBottomLeft += xyz;
						stairs.m_RightUpRunData.PtRunBottomRight += xyz;
						stairs.m_RightUpRunData.PtRunTopLeft += xyz;
						stairs.m_RightUpRunData.PtRunTopRight += xyz;
						return;
					}
					stairs.m_LeftDownRunData.PtRunBottomLeft += xyz2;
					stairs.m_LeftDownRunData.PtRunBottomRight += xyz2;
					stairs.m_LeftDownRunData.PtRunTopLeft += xyz2;
					stairs.m_LeftDownRunData.PtRunTopRight += xyz2;
					stairs.m_LeftUpRunData.PtRunBottomLeft += xyz;
					stairs.m_LeftUpRunData.PtRunBottomRight += xyz;
					stairs.m_LeftUpRunData.PtRunTopLeft += xyz;
					stairs.m_LeftUpRunData.PtRunTopRight += xyz;
					stairs.m_RightUpRunData.PtRunBottomLeft += xyz2;
					stairs.m_RightUpRunData.PtRunBottomRight += xyz2;
					stairs.m_RightUpRunData.PtRunTopLeft += xyz2;
					stairs.m_RightUpRunData.PtRunTopRight += xyz2;
					return;
				}
				else if (2 == nTreadAlignType)
				{
					stairs.m_LeftUpRunData.PtRunBottomLeft += xyz;
					stairs.m_LeftUpRunData.PtRunBottomRight += xyz;
					stairs.m_LeftUpRunData.PtRunTopLeft += xyz;
					stairs.m_LeftUpRunData.PtRunTopRight += xyz;
					stairs.m_RightUpRunData.PtRunBottomLeft += xyz;
					stairs.m_RightUpRunData.PtRunBottomRight += xyz;
					stairs.m_RightUpRunData.PtRunTopLeft += xyz;
					stairs.m_RightUpRunData.PtRunTopRight += xyz;
				}
			}
		}

		private void DrawCrossingStairsRunCurves(ref CrossingStairs param_stairs, bool bLeftSideUp, bool bDrawNoteInfo)
		{
			if (param_stairs != null)
			{
				LineRunData leftDownRunData = param_stairs.m_LeftDownRunData;
				LineRunData leftUpRunData = param_stairs.m_LeftUpRunData;
				LineRunData rightDownRunData = param_stairs.m_RightDownRunData;
				LineRunData rightUpRunData = param_stairs.m_RightUpRunData;
				if (bLeftSideUp)
				{
					SingleRunCurveInfo singleRunCurveInfo = new SingleRunCurveInfo();
					singleRunCurveInfo.BottomElevation = leftDownRunData.BottomElevation;
					base.DrawLinearRun(leftDownRunData, leftDownRunData.PtRunBottomLeft, leftDownRunData.PtRunBottomRight, leftDownRunData.PtRunTopRight, leftDownRunData.PtRunTopLeft, ref singleRunCurveInfo, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
					param_stairs.m_listRunCurve.Add(singleRunCurveInfo);
					singleRunCurveInfo = new SingleRunCurveInfo();
					singleRunCurveInfo.BottomElevation = leftUpRunData.BottomElevation;
					base.DrawLinearRun(leftUpRunData, leftUpRunData.PtRunBottomLeft, leftUpRunData.PtRunBottomRight, leftUpRunData.PtRunTopRight, leftUpRunData.PtRunTopLeft, ref singleRunCurveInfo, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
					param_stairs.m_listRunCurve.Add(singleRunCurveInfo);
					singleRunCurveInfo = new SingleRunCurveInfo();
					singleRunCurveInfo.BottomElevation = rightUpRunData.BottomElevation;
					base.DrawLinearRun(rightUpRunData, rightUpRunData.PtRunTopRight, rightUpRunData.PtRunTopLeft, rightUpRunData.PtRunBottomLeft, rightUpRunData.PtRunBottomRight, ref singleRunCurveInfo, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
					param_stairs.m_listRunCurve.Add(singleRunCurveInfo);
					singleRunCurveInfo = new SingleRunCurveInfo();
					singleRunCurveInfo.BottomElevation = rightDownRunData.BottomElevation;
					base.DrawLinearRun(rightDownRunData, rightDownRunData.PtRunTopRight, rightDownRunData.PtRunTopLeft, rightDownRunData.PtRunBottomLeft, rightDownRunData.PtRunBottomRight, ref singleRunCurveInfo, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
					param_stairs.m_listRunCurve.Add(singleRunCurveInfo);
					return;
				}
				SingleRunCurveInfo singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = rightDownRunData.BottomElevation;
				base.DrawLinearRun(rightDownRunData, rightDownRunData.PtRunBottomLeft, rightDownRunData.PtRunBottomRight, rightDownRunData.PtRunTopRight, rightDownRunData.PtRunTopLeft, ref singleRunCurveInfo2, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
				param_stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = rightUpRunData.BottomElevation;
				base.DrawLinearRun(rightUpRunData, rightUpRunData.PtRunBottomLeft, rightUpRunData.PtRunBottomRight, rightUpRunData.PtRunTopRight, rightUpRunData.PtRunTopLeft, ref singleRunCurveInfo2, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
				param_stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = leftUpRunData.BottomElevation;
				base.DrawLinearRun(leftUpRunData, leftUpRunData.PtRunTopRight, leftUpRunData.PtRunTopLeft, leftUpRunData.PtRunBottomLeft, leftUpRunData.PtRunBottomRight, ref singleRunCurveInfo2, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
				param_stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = leftDownRunData.BottomElevation;
				base.DrawLinearRun(leftDownRunData, leftDownRunData.PtRunTopRight, leftDownRunData.PtRunTopLeft, leftDownRunData.PtRunBottomLeft, leftDownRunData.PtRunBottomRight, ref singleRunCurveInfo2, ref param_stairs.m_listOtherCurve, bDrawNoteInfo);
				param_stairs.m_listRunCurve.Add(singleRunCurveInfo2);
			}
		}

		private void DrawCrossingStairsLandCurves(ref CrossingStairs param_stairs, int nTreadAlignType)
		{
			if (param_stairs != null && param_stairs.m_LandData.Width > 0.0)
			{
				LineRunData leftDownRunData = param_stairs.m_LeftDownRunData;
				LineRunData leftUpRunData = param_stairs.m_LeftUpRunData;
				LineRunData rightDownRunData = param_stairs.m_RightDownRunData;
				LineRunData rightUpRunData = param_stairs.m_RightUpRunData;
				if (nTreadAlignType == 0)
				{
					List<CurveInfo> landCurves = base.CreateLandEdgeloop(new List<XYZ>
					{
						leftDownRunData.PtRunTopLeft,
						leftUpRunData.PtRunBottomLeft,
						rightUpRunData.PtRunBottomRight,
						rightDownRunData.PtRunTopRight
					});
					double bottomElevation = 0.0;
					LandingCurveInfo item = new LandingCurveInfo(landCurves, bottomElevation);
					param_stairs.m_listLandCurve.Add(item);
					return;
				}
				if (1 == nTreadAlignType)
				{
					if (leftDownRunData.TreadCount == leftUpRunData.TreadCount)
					{
						List<CurveInfo> landCurves2 = base.CreateLandEdgeloop(new List<XYZ>
						{
							leftDownRunData.PtRunTopLeft,
							leftUpRunData.PtRunBottomLeft,
							rightUpRunData.PtRunBottomRight,
							rightDownRunData.PtRunTopRight
						});
						double bottomElevation2 = 0.0;
						LandingCurveInfo item2 = new LandingCurveInfo(landCurves2, bottomElevation2);
						param_stairs.m_listLandCurve.Add(item2);
						return;
					}
					bool flag = false;
					if (leftDownRunData.TreadCount > leftUpRunData.TreadCount)
					{
						flag = true;
					}
					double num = Math.Abs(leftDownRunData.RunLength - leftUpRunData.RunLength) / 2.0;
					XYZ xyz = new XYZ(0.0, num, 0.0);
					if (flag)
					{
						XYZ item3 = leftUpRunData.PtRunBottomRight - xyz;
						XYZ item4 = rightDownRunData.PtRunTopLeft + xyz;
						List<CurveInfo> landCurves3 = base.CreateLandEdgeloop(new List<XYZ>
						{
							leftDownRunData.PtRunTopLeft,
							leftUpRunData.PtRunBottomLeft,
							leftUpRunData.PtRunBottomRight,
							item3,
							rightUpRunData.PtRunBottomLeft,
							rightUpRunData.PtRunBottomRight,
							rightDownRunData.PtRunTopRight,
							rightDownRunData.PtRunTopLeft,
							item4,
							leftDownRunData.PtRunTopRight
						});
						double bottomElevation3 = 0.0;
						LandingCurveInfo item5 = new LandingCurveInfo(landCurves3, bottomElevation3);
						param_stairs.m_listLandCurve.Add(item5);
						return;
					}
					XYZ item6 = leftDownRunData.PtRunTopRight + xyz;
					XYZ item7 = rightUpRunData.PtRunBottomLeft - xyz;
					List<CurveInfo> landCurves4 = base.CreateLandEdgeloop(new List<XYZ>
					{
						leftDownRunData.PtRunTopLeft,
						leftUpRunData.PtRunBottomLeft,
						leftUpRunData.PtRunBottomRight,
						item7,
						rightUpRunData.PtRunBottomLeft,
						rightUpRunData.PtRunBottomRight,
						rightDownRunData.PtRunTopRight,
						rightDownRunData.PtRunTopLeft,
						item6,
						leftDownRunData.PtRunTopRight
					});
					double bottomElevation4 = 0.0;
					LandingCurveInfo item8 = new LandingCurveInfo(landCurves4, bottomElevation4);
					param_stairs.m_listLandCurve.Add(item8);
					return;
				}
				else if (2 == nTreadAlignType)
				{
					if (leftUpRunData.TreadCount != leftDownRunData.TreadCount)
					{
						bool flag2 = false;
						if (leftDownRunData.TreadCount > leftUpRunData.TreadCount)
						{
							flag2 = true;
						}
						double num2 = leftDownRunData.RunLength - leftUpRunData.RunLength;
						num2 = Math.Abs(num2);
						XYZ xyz2 = new XYZ(0.0, num2, 0.0);
						if (flag2)
						{
							XYZ item9 = leftUpRunData.PtRunBottomRight - xyz2;
							XYZ item10 = rightDownRunData.PtRunTopLeft + xyz2;
							List<CurveInfo> landCurves5 = base.CreateLandEdgeloop(new List<XYZ>
							{
								leftDownRunData.PtRunTopLeft,
								leftUpRunData.PtRunBottomLeft,
								leftUpRunData.PtRunBottomRight,
								item9,
								rightUpRunData.PtRunBottomLeft,
								rightUpRunData.PtRunBottomRight,
								rightDownRunData.PtRunTopRight,
								rightDownRunData.PtRunTopLeft,
								item10,
								leftDownRunData.PtRunTopRight
							});
							double bottomElevation5 = 0.0;
							LandingCurveInfo item11 = new LandingCurveInfo(landCurves5, bottomElevation5);
							param_stairs.m_listLandCurve.Add(item11);
							return;
						}
						XYZ item12 = leftDownRunData.PtRunTopRight + xyz2;
						XYZ item13 = rightUpRunData.PtRunBottomLeft - xyz2;
						List<CurveInfo> landCurves6 = base.CreateLandEdgeloop(new List<XYZ>
						{
							leftDownRunData.PtRunTopLeft,
							leftUpRunData.PtRunBottomLeft,
							leftUpRunData.PtRunBottomRight,
							item13,
							rightUpRunData.PtRunBottomLeft,
							rightUpRunData.PtRunBottomRight,
							rightDownRunData.PtRunTopRight,
							rightDownRunData.PtRunTopLeft,
							item12,
							leftDownRunData.PtRunTopRight
						});
						double bottomElevation6 = 0.0;
						LandingCurveInfo item14 = new LandingCurveInfo(landCurves6, bottomElevation6);
						param_stairs.m_listLandCurve.Add(item14);
						return;
					}
					else
					{
						List<CurveInfo> landCurves7 = base.CreateLandEdgeloop(new List<XYZ>
						{
							leftDownRunData.PtRunTopLeft,
							leftUpRunData.PtRunBottomLeft,
							rightUpRunData.PtRunBottomRight,
							rightDownRunData.PtRunTopRight
						});
						double bottomElevation7 = 0.0;
						LandingCurveInfo item15 = new LandingCurveInfo(landCurves7, bottomElevation7);
						param_stairs.m_listLandCurve.Add(item15);
					}
				}
			}
		}

		private void DrawCrossingStairsBeamCurves(ref CrossingStairs param_stairs, bool bMid)
		{
			if (param_stairs != null && bMid)
			{
				LineRunData leftUpRunData = param_stairs.m_LeftUpRunData;
				LineRunData leftDownRunData = param_stairs.m_LeftDownRunData;
				LineRunData rightUpRunData = param_stairs.m_RightUpRunData;
				LineRunData rightDownRunData = param_stairs.m_RightDownRunData;
				double num = param_stairs.m_BeamData.BeamWidth / 2.0;
				XYZ xyz = new XYZ(0.0, num, 0.0);
				XYZ xyz2 = XYZ.Zero;
				XYZ ptE = XYZ.Zero;
				if (leftUpRunData.TreadCount != leftDownRunData.TreadCount)
				{
					XYZ xyz3 = new XYZ(param_stairs.m_dStairsWidth, 0.0, 0.0);
					bool flag = false;
					if (leftUpRunData.TreadCount < leftDownRunData.TreadCount)
					{
						flag = true;
					}
					if (flag)
					{
						List<CurveInfo> list = new List<CurveInfo>();
						xyz2 = leftDownRunData.PtRunTopLeft + xyz;
						ptE = xyz2 + xyz3;
						list.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
						xyz2 = rightUpRunData.PtRunBottomRight - xyz;
						ptE = xyz2 - xyz3;
						list.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
						double bottomElevation = leftDownRunData.BottomElevation;
						BeamCurveInfo beamCurveInfo = new BeamCurveInfo(list, bottomElevation);
						beamCurveInfo.m_Type = BeamType.BT_Mid;
						beamCurveInfo.m_nFloorNum = 0;
						param_stairs.m_listBeamCurve.Add(beamCurveInfo);
						return;
					}
					List<CurveInfo> list2 = new List<CurveInfo>();
					xyz2 = leftUpRunData.PtRunBottomLeft - xyz;
					ptE = xyz2 + xyz3;
					list2.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
					xyz2 = rightDownRunData.PtRunTopRight + xyz;
					ptE = xyz2 - xyz3;
					list2.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
					double bottomElevation2 = leftDownRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo2 = new BeamCurveInfo(list2, bottomElevation2);
					beamCurveInfo2.m_Type = BeamType.BT_Mid;
					beamCurveInfo2.m_nFloorNum = 0;
					param_stairs.m_listBeamCurve.Add(beamCurveInfo2);
					return;
				}
				else
				{
					List<CurveInfo> list3 = new List<CurveInfo>();
					xyz2 = leftDownRunData.PtRunTopLeft + xyz;
					ptE = rightDownRunData.PtRunTopRight + xyz;
					list3.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
					xyz2 = leftUpRunData.PtRunBottomLeft - xyz;
					ptE = rightUpRunData.PtRunBottomRight - xyz;
					list3.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, xyz2, ptE, null));
					double bottomElevation3 = leftDownRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo3 = new BeamCurveInfo(list3, bottomElevation3);
					beamCurveInfo3.m_Type = BeamType.BT_Mid;
					beamCurveInfo3.m_nFloorNum = 0;
					param_stairs.m_listBeamCurve.Add(beamCurveInfo3);
				}
			}
		}

		public bool CrossingStairsProfileCurves(ref CrossingStairs stairs, bool bDrawNoteInfo, int nTreadAlignType, int basePointIndex, bool lrMirror, bool tbMirror, bool bLeftSideUp, double rotateAngle, bool bMid)
		{
			bool result = true;
			LineRunData leftUpRunData = stairs.m_LeftUpRunData;
			LineRunData leftDownRunData = stairs.m_LeftDownRunData;
			LineRunData rightUpRunData = stairs.m_RightUpRunData;
			LineRunData rightDownRunData = stairs.m_RightDownRunData;
			double width = stairs.m_LandData.Width;
			stairs.GetStairsWellWidth();
			double dStairsWidth = stairs.m_dStairsWidth;
			double bundingBoxHeight = leftUpRunData.RunLength + leftDownRunData.RunLength + width;
			this.CalcStairsRunsOriginPoints(ref stairs);
			this.DealStairsTreadAlign(ref stairs, nTreadAlignType);
			List<XYZ> list = new List<XYZ>();
			list.Add(stairs.m_LeftDownRunData.PtRunBottomLeft);
			list.Add(stairs.m_LeftUpRunData.PtRunTopLeft);
			list.Add(stairs.m_RightUpRunData.PtRunTopRight);
			list.Add(stairs.m_RightDownRunData.PtRunBottomRight);
			stairs.m_listPointsSupport.Add(leftDownRunData.PtRunBottomLeft);
			stairs.m_listPointsSupport.Add(leftDownRunData.PtRunTopLeft);
			stairs.m_listPointsSupport.Add(leftUpRunData.PtRunBottomLeft);
			stairs.m_listPointsSupport.Add(leftUpRunData.PtRunTopLeft);
			stairs.m_listPointsSupport.Add(rightDownRunData.PtRunBottomRight);
			stairs.m_listPointsSupport.Add(rightDownRunData.PtRunTopRight);
			stairs.m_listPointsSupport.Add(rightUpRunData.PtRunBottomRight);
			stairs.m_listPointsSupport.Add(rightUpRunData.PtRunTopRight);
			XYZ xyz = list[basePointIndex];
			base.CalulateTransform(lrMirror, tbMirror, rotateAngle, dStairsWidth, bundingBoxHeight, xyz);
			stairs.m_TransVector = Geometry.TransformPoint(xyz, this.m_Transform);
			stairs.m_listOtherCurve.AddRange(base.DrawBasePoint(xyz, 100.0));
			stairs.m_Transform = this.m_Transform;
			this.DrawCrossingStairsRunCurves(ref stairs, bLeftSideUp, bDrawNoteInfo);
			this.DrawCrossingStairsLandCurves(ref stairs, nTreadAlignType);
			this.DrawCrossingStairsBeamCurves(ref stairs, bMid);
			this.DrawCrossingStairsNoteInfo(ref stairs, bLeftSideUp, nTreadAlignType);
			if (bDrawNoteInfo)
			{
				this.DrawUpStairsNoteInfo(ref stairs, bLeftSideUp);
			}
			return result;
		}

		private void DrawCrossingStairsNoteInfo(ref CrossingStairs param_stairs, bool bLeftSideUp, int nTreadAlignType)
		{
			bool flag = Math.Abs(param_stairs.GetStairsWellWidth()) >= 1E-07;
			LineRunData leftUpRunData = param_stairs.m_LeftUpRunData;
			LineRunData leftDownRunData = param_stairs.m_LeftDownRunData;
			LineRunData rightUpRunData = param_stairs.m_RightUpRunData;
			LineRunData rightDownRunData = param_stairs.m_RightDownRunData;
			double width = param_stairs.m_LandData.Width;
			new XYZ(0.0, width, 0.0);
			XYZ xyz = XYZ.BasisY * 2.0;
			XYZ xyz2 = XYZ.BasisX * 2.0;
			XYZ xyz3 = XYZ.Zero;
			XYZ ptEnd = XYZ.Zero;
			if (bLeftSideUp)
			{
				xyz3 = rightDownRunData.PtRunBottomLeft - xyz;
				ptEnd = rightDownRunData.PtRunBottomRight - xyz;
			}
			else
			{
				xyz3 = leftDownRunData.PtRunBottomLeft - xyz;
				ptEnd = leftDownRunData.PtRunBottomRight - xyz;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "二跑梯段", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			if (bLeftSideUp)
			{
				xyz3 = leftDownRunData.PtRunBottomLeft - xyz;
				ptEnd = leftDownRunData.PtRunBottomRight - xyz;
			}
			else
			{
				xyz3 = rightDownRunData.PtRunBottomLeft - xyz;
				ptEnd = rightDownRunData.PtRunBottomRight - xyz;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "一跑梯段", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			if (nTreadAlignType == 0 || rightDownRunData.TreadCount == leftDownRunData.TreadCount)
			{
				xyz3 = leftDownRunData.PtRunTopLeft + XYZ.BasisY * 1.0;
				ptEnd = rightDownRunData.PtRunTopRight + XYZ.BasisY * 1.0;
			}
			else
			{
				XYZ xyz4 = new XYZ(param_stairs.m_dStairsWidth, 0.0, 0.0);
				if (rightDownRunData.TreadCount > leftDownRunData.TreadCount)
				{
					xyz3 = rightDownRunData.PtRunTopRight + XYZ.BasisY * 1.0;
					ptEnd = xyz3 - xyz4;
				}
				else
				{
					xyz3 = leftDownRunData.PtRunTopLeft + XYZ.BasisY * 1.0;
					ptEnd = xyz3 + xyz4;
				}
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "梯间宽度", 0.8, 5.0, 2.0, XYZ.BasisY, PenColor.PC_Black);
			XYZ xyz5 = new XYZ(0.0, leftUpRunData.TreadDepth, 0.0);
			xyz3 = rightUpRunData.PtRunTopRight + xyz2;
			ptEnd = xyz3 - xyz5;
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "踏步宽度", 0.8, 2.0, 5.0, XYZ.BasisX, PenColor.PC_Black);
			xyz3 = rightUpRunData.PtRunBottomRight + xyz2;
			ptEnd = rightDownRunData.PtRunTopRight + xyz2;
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "平台宽度", 0.8, 2.0, 5.0, XYZ.BasisX, PenColor.PC_Black);
			if (flag)
			{
				XYZ xyz6 = new XYZ(param_stairs.GetStairsWellWidth(), 0.0, 0.0);
				xyz3 = leftUpRunData.PtRunTopRight + xyz;
				ptEnd = xyz3 + xyz6;
				base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "梯井宽", 0.8, 5.0, 2.0, XYZ.BasisY, PenColor.PC_Black);
			}
			if (bLeftSideUp)
			{
				xyz3 = leftDownRunData.PtRunBottomLeft - xyz2;
				ptEnd = leftDownRunData.PtRunTopLeft - xyz2;
			}
			else
			{
				xyz3 = leftUpRunData.PtRunBottomLeft - xyz2;
				ptEnd = leftUpRunData.PtRunTopLeft - xyz2;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "一跑梯段", 0.8, 2.0, 5.0, -XYZ.BasisX, PenColor.PC_Black);
			if (bLeftSideUp)
			{
				xyz3 = rightUpRunData.PtRunTopRight + xyz2 * 2.5;
				ptEnd = rightUpRunData.PtRunBottomRight + xyz2 * 2.5;
			}
			else
			{
				xyz3 = rightDownRunData.PtRunTopRight + xyz2 * 2.5;
				ptEnd = rightDownRunData.PtRunBottomRight + xyz2 * 2.5;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "一跑梯段", 0.8, 2.0, 5.0, XYZ.BasisX, PenColor.PC_Black);
			if (bLeftSideUp)
			{
				xyz3 = leftUpRunData.PtRunBottomLeft - xyz2;
				ptEnd = leftUpRunData.PtRunTopLeft - xyz2;
			}
			else
			{
				xyz3 = leftDownRunData.PtRunBottomLeft - xyz2;
				ptEnd = leftDownRunData.PtRunTopLeft - xyz2;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "二跑梯段", 0.8, 2.0, 5.0, -XYZ.BasisX, PenColor.PC_Black);
			if (bLeftSideUp)
			{
				xyz3 = rightDownRunData.PtRunTopRight + xyz2 * 2.5;
				ptEnd = rightDownRunData.PtRunBottomRight + xyz2 * 2.5;
			}
			else
			{
				xyz3 = rightUpRunData.PtRunTopRight + xyz2 * 2.5;
				ptEnd = rightUpRunData.PtRunBottomRight + xyz2 * 2.5;
			}
			base.DrawStairsNoteInfo(ref param_stairs.m_listOtherCurve, ref param_stairs.m_listText, xyz3, ptEnd, "二跑梯段", 0.8, 2.0, 5.0, XYZ.BasisX, PenColor.PC_Black);
		}

		private void DrawUpStairsNoteInfo(ref CrossingStairs param_stairs, bool bLeftSideUp)
		{
			LineRunData leftUpRunData = param_stairs.m_LeftUpRunData;
			LineRunData leftDownRunData = param_stairs.m_LeftDownRunData;
			LineRunData rightUpRunData = param_stairs.m_RightUpRunData;
			LineRunData rightDownRunData = param_stairs.m_RightDownRunData;
			XYZ xyz = XYZ.BasisY * 1.3;
			List<UpDownText> list = new List<UpDownText>();
			string sText = "上";
			string sText2 = "下";
			if (bLeftSideUp)
			{
				XYZ pos = Geometry.CalculatMidPoint(leftDownRunData.PtRunBottomLeft, leftDownRunData.PtRunBottomRight) - xyz;
				XYZ pos2 = Geometry.CalculatMidPoint(rightUpRunData.PtRunTopLeft, rightUpRunData.PtRunTopRight) + xyz;
				XYZ pos3 = Geometry.CalculatMidPoint(leftUpRunData.PtRunTopLeft, leftUpRunData.PtRunTopRight) + xyz;
				XYZ pos4 = Geometry.CalculatMidPoint(rightDownRunData.PtRunBottomLeft, rightDownRunData.PtRunBottomRight) - xyz;
				UpDownText item = new UpDownText(pos, sText);
				list.Add(item);
				item = new UpDownText(pos2, sText);
				list.Add(item);
				item = new UpDownText(pos3, sText2);
				list.Add(item);
				item = new UpDownText(pos4, sText2);
				list.Add(item);
				base.DrawUpDownNoteInfo(ref param_stairs.m_listText, list);
				return;
			}
			XYZ pos5 = Geometry.CalculatMidPoint(leftUpRunData.PtRunTopLeft, leftUpRunData.PtRunTopRight) + xyz;
			XYZ pos6 = Geometry.CalculatMidPoint(rightDownRunData.PtRunBottomLeft, rightDownRunData.PtRunBottomRight) - xyz;
			XYZ pos7 = Geometry.CalculatMidPoint(leftDownRunData.PtRunBottomLeft, leftDownRunData.PtRunBottomRight) - xyz;
			XYZ pos8 = Geometry.CalculatMidPoint(rightUpRunData.PtRunTopLeft, rightUpRunData.PtRunTopRight) + xyz;
			UpDownText item2 = new UpDownText(pos5, sText);
			list.Add(item2);
			item2 = new UpDownText(pos6, sText);
			list.Add(item2);
			item2 = new UpDownText(pos7, sText2);
			list.Add(item2);
			item2 = new UpDownText(pos8, sText2);
			list.Add(item2);
			base.DrawUpDownNoteInfo(ref param_stairs.m_listText, list);
		}
	}
}
